﻿<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <title>加载中...</title>
    <script src="./comm/jquery.min.js"></script>
    <script> 
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]); return null;
        }
        var s = GetQueryString("state");
        var value = localStorage.getItem("sq_openid");
        if (value) {
            switch (s) {
                case "user":
                    window.location.href = "http://web.qudon.cn/user.html#/url?openid=" + value + "&s=" + s;
                    break;
                case "px":
                    window.location.href = "http://web.qudon.cn/mdlist.html?openid=" + value;
                    break;
                case "youka":
                    window.location.href = "http://web.qudon.cn/user.html#/url?openid=" + value + "&s=" + s;
                    break;
                case "order":
                    window.location.href = "http://web.qudon.cn/user.html#/url?openid=" + value + "&s=" + s;
                    break;
                case "myyou":
                    window.location.href = "http://web.qudon.cn/myyou.html?openid=" + value;
                    break;
            }
        } else {
            var code = GetQueryString("code");
            $.get("http://m.qudon.cn/wx/info/code/A8E63B46F388B05886580B5A466DD70D?code=" + code, null, function (data) {
                var j = JSON.parse(data);
                $.post("http://119.27.165.248:8062/user/concernMerchant", { openId: j.openId, cmId: 1497404204066, userName: j.nickName, headImg: j.photo, sex: j.gender }, function (data1) {
                    if (data1.executed) {
                        localStorage.setItem("sq_openid", j.openId);
                        switch (s) {
                            case "user":
                                window.location.href = "http://web.qudon.cn/user.html#/url?openid=" + j.openId + "&s=" + s;
                                break;
                            case "px":
                                window.location.href = "http://web.qudon.cn/mdlist.html?openid=" + j.openId;
                                break;
                            case "youka":
                                window.location.href = "http://web.qudon.cn/user.html#/url?openid=" + j.openId + "&s=" + s;
                                break;
                            case "order":
                                window.location.href = "http://web.qudon.cn/user.html#/url?openid=" + j.openId + "&s=" + s;
                                break;
                            case "myyou":
                                window.location.href = "http://web.qudon.cn/myyou.html?openid=" + j.openId;
                                break;
                        }
                    }
                });
            });
        }
    </script>
</head>

<body>

</body>

</html>